The following article is based on a Macintosh Tech Note titled "HW 30 - Sense Lines" originally written by Rich Collyer and Blake Roberts. It provides a detailed explanation of the standard and extended sense codes used to determine which monitor is connected to a particular Macintosh computer or video card.
The sense line protocol was implemented when Apple recognized the need for a mechanism that would allow a display card to identify the monitor connected to it. For example, the built-in video display circuitry on CPUs such as the Macintosh Quadras and the PowerBook 160 and 165c can configure itself according to the monitor that is connected at boot time. The identification scheme works fine, but there is one problem. There are only three sense lines and this limits the number of different monitors to seven plus the no-connect case. To overcome this limitation, newer display cards and built-in video use extensions to the sense line scheme that allow for new codes.
The first extension, type-7, is based on the following idea: When the display circuitry senses a configuration that in the original scheme signals “no display connected” (i.e. when none of the three sense lines are grounded), the card pulls down each sense line, one by one, and reads what the other lines return. To return a unique code, the only requirement is that the sense lines be interconnected, in the cable or the monitor itself, by wires or diodes. The beauty of this idea is that existing monitors are detected correctly and newer monitors can have their own encoding. The circuitry for detecting new monitors is relatively simple and has no active components. Adding the encoding to new or existing monitors involves only inexpensive diodes and wire. The type-6 extension has a similar approach.
The Original Scheme
-------------------
In the original scheme, the display circuitry determines the type of monitor attached by reading three sense lines and comparing the signal value to ground. By convention, the sense lines are identified as 2, 1, and 0. Given three lines and two different states, on or off, there are a total of eight possible combinations. For a monitor to be recognized, a sense line on the monitor side is connected to ground to be read as a binary 0, or left unconnected to be read as a binary 1.
The first seven monitors listed in Table S-1 show the required sense line states for them to be recognized using the original sense line scheme. It’s worth noting that monitors using the original scheme need only have their sense lines read once to determine the monitor type. As new monitor types became available for the Macintosh, the extended sense line protocol was implemented.
Extended Type-7 Sense Codes
---------------------------
The extended sense line protocol is one of those oddities of software engineering that at first seems to defy logic. The protocol sets a standard for defining a 6-bit binary number that represents how the sense lines must respond for the monitor to be recognized correctly.
With this unusual introduction, let’s step back. Under the original scheme, sense lines were compared to ground to determine their state. To reiterate, with three pins there are a total of eight possible combinations, 000 (all grounded) to 111 (none grounded). Seven combinations of the sense line states are assigned to early monitor types. The eighth combination, 111 (signifying "no display connected" in the original scheme), is used to signal the extended type-7 sense line code protocol. This is also known as the no-connect sense line code protocol. The type-7 designation derives from the fact that the three sense lines are high relative to ground and can be represented in binary format as 0b111 or $07.
To implement the type-7 sense line protocol, the sense lines get tied to each other within the monitor using a combination of straight wire and/or diode connections. When the display system software reads the state of the three monitor sense lines and finds that none of them are grounded, it begins dynamic polling. The software tells the video card/hardware to assert each sense line and read the other two lines. Instead of being compared to ground, each line is compared to the asserted line. If a sense line has the same state as the asserted sense line, the state equates to a binary 0, otherwise it is binary 1.
The diagram in Figure 1 illustrates the type-7 sense line protocol notation. There are three pairs of binary numbers. Each pair of binary digits represents the relative state of two sense line pins to the third, which is held low. The pairs are always in the order: sense 2 low, sense 1 low, sense 0 low. Each bit in a pair is sense line specific, with the higher sense line bit to the left.
Begin_Graphic
_____________ Sense 1 low, Sense 2 state
| ____________ Sense 1 low, Sense 0 state
||
XX XX XX
Sense 2 low, Sense 1 state____|| ||_________ Sense 0 low, Sense 2 state
Sense 2 low, Sense 0 state_____| |__________ Sense 0 low, Sense 1 state
Figure 1—Extended Type-7 Sense Line Decode Method
End_Graphic
Extended Type-6 Sense Line Protocol
-----------------------------------
With the implementation of the Display Manager, the sense line protocol was extended further for a new family of monitors. The same method that gives the extended type-7 sense line protocol its designation applies to the three cases where one sense line is grounded. For the extended type-6 sense line protocol, pin 4, i.e. sense line 0, is grounded to pin 11 (see Table S-3) and the binary notation is expressed as 0b110 ($06) with the least significant bit representing sense line 0.
From Table S-1 below, note that the sense line configuration for this case corresponds to the Apple Hi-Res monitor. To extend the support of monitors in this family, one can add three new codes by connecting sense lines 1 and 2 with a jumper, or a diode in either direction. These new extended type-6 sense codes support three new monitor types which are capable of supporting the standard 640x480 resolution and other resolutions. See "Multiple Scan Monitors" below.
Multiple Scan Monitors
----------------------
The Power Macintosh VRAM expansion cards include support for three new monitor types which use the extended type-6 sense codes. These new types are multiple scan rate monitors which can display in multiple screen resolutions. The VRAM expansion cards being shipped with the Power Macintosh units will support the multiple scan monitors with the resolutions listed in Table 1. Note that the Apple Multiple Scan 17 Display is sensed as a multiple scan 16 display type and the Apple Multiple Scan 20 Display is sensed as a multiple scan 21 display type.
* These monitors require extended sense line support.
† Interlaced timing.
Note: The binary values in this table indicate the relative state of the sense pin measured against monitor ground, pin 11, on the DB-15 connector depicted in Table S-3 below.
Begin_Table
Table S-2 Extended Sense Line Code Assignments
Sense 2 Low Sense 1 Low Sense 0 Low
Monitor Type 1 & 0 2 & 0 2 & 1
Multiple Scan 14" * 00 00 11
Multiple Scan 16" * 00 10 11
Multiple Scan 21" * 10 00 11
PAL Encoder 00 00 00
NTSC Encoder 01 01 00
VGA/Super VGA 01 01 11
RGB 16" 10 11 01
PAL Monitor 11 00 00
RGB 19" 11 10 10
* Type-6
End_Table
Note: In this table, the column under "Sense 2 Low 1 & 0" indicates the values the software is reading from monitor sense lines 1 and 0 while driving sense line 2 low. Suppose you have a PowerBook 180c and you want it to believe there is an Apple 16" RGB monitor attached. The sense line code in Table S-2 for this monitor is 10 11 01. As shown in Figure 3, this sense code equates to sense line 2 being connected to sense line 0 with a jumper. Based on Table S-3, your tying pin 4 to pin 10 will make the PowerBook think that the 16" monitor is attached. It’s important to recognize that pins 4 and 10 in this example must not be tied to ground, otherwise a 12" RGB monitor would be indicated.
Begin_Table
Table S-3 Signal Assignments for the DB-15 External Video Connector
Pin Signal Name Signal Description
--- ----------- ------------------
1 RED.GND Red Ground
2 RED.VID Red Video Signal
3 /CSYNC Composite Sync Signal
4 SENSE0 Monitor Sense Line 0
5 GRN.VID Green Video Signal
6 GRN.GND Green Ground
7 SENSE1 Monitor Sense Line 1
8 n.c. Not Connected
9 BLU.VID Blue Video Signal
10 SENSE2 Monitor Sense Line 2
11 C&VSYNC.GND Ground for CSYNC & VSYNC
12 /VSYNC Vertical Sync Signal
13 BLU.GND Blue Ground
14 HSYNC.GND HSYNC Ground
15 /HSYNC Horizontal Sync Signal
End_Table
Further Reference:
• Guide to the Macintosh Family Hardware, Third edition, Video Displays
• Technical Note M.HW.ColorMonitors—HW 8 - Color Monitor Connections
This article is one of many available through the Apple Fax center. For a complete list of available fax documents, search the Tech Info Library for Apple Fax Document Index or call the Apple Fax line at 1-800-505-0171 and select document number 20000 (Apple Fax - Document Index - Product Support Literature). The Apple Fax center is available free of charge 24 hours a day, 7 days a week.
Article Change History:
02 Jul 1996 - Added Fax Doc word
15 Nov 1995 - Added information about Multiple Scan 14.
09 Aug 1995 - Reformatted to make more readible on the World Wide Web.